-
Notifications
You must be signed in to change notification settings - Fork 11
feat(input_schema): Add enumSuggestedValues property to input schema #569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the enumSuggestedValues property to input schemas, providing an alternative to enum that allows custom values while providing UI suggestions.
Key changes:
- Added
enumSuggestedValuesproperty that acts as UI hints without enforcing validation - Extended
stringPropertyandsubSchemaStringPropertyto supporteditor: 'select'withenumSuggestedValues - Updated
arrayItemsSelectto support eitherenumorenumSuggestedValues(mutually exclusive) - Comprehensive test coverage for both string and array properties with various edge cases
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
test/input_schema.test.ts |
Added 13 comprehensive test cases covering enumSuggestedValues usage with string and array properties, validation of mutual exclusivity with enum, and editor requirements |
packages/json_schemas/schemas/input.schema.json |
Added select editor support to stringProperty and subSchemaStringProperty with conditional enumSuggestedValues requirement; updated arrayItemsSelect to use oneOf for enum/enumSuggestedValues exclusivity; reordered editor enums consistently |
packages/input_schema/src/types.ts |
Added enumSuggestedValues property to StringFieldDefinition type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
valekjo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Input schema is getting pimped up :)
We'll need eat and learn on the new features
Solves https://github.com/apify/apify-core/issues/24101 - adds support for
enumSuggestedValuesproperty, that can be used instead ofenumand it:I put this to
stringProperty, accepting nowselecteditor (only ifenumSuggestedValuesis specified), because it supports also other validation keywords (pattern,...) which makes totally sense to put another constraints on the custom value. (But there's no reason to allow these additional validation keywords when usingenum.)Other things works still the same
enumcan be defined only ifeditoris not defined or isselectenumSuggestedValuescan be defined only ifeditorisselect.enumorenumSuggestedValuescan (must) be defined ifeditorisselectDraft with changes to make this work in UI is ready here: https://github.com/apify/apify-core/pull/24164